package com.bawei.composeui2207a.day01

import android.util.Log
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.blankj.utilcode.util.ToastUtils

/**
 * 作者：赵亮
 * 时间：2024/12/10 12:28
 * 功能：按钮
 */
@Composable
fun Page3() {
    Column {
        // 点击事件
        Button(onClick = {
            ToastUtils.showShort("点击登录")
            Log.i("TAG", "Page3: 点击登录")
        }) {
            Text(text = "登录")
        }
        // 宽高
        Button(
            modifier = Modifier
                .fillMaxWidth()
                .padding(start = 20.dp, end = 20.dp),
            onClick = { /*TODO*/ }) {
            Text(text = "注册")
        }

        // 颜色
        Button(
            modifier = Modifier.fillMaxWidth(),
            colors = ButtonDefaults.buttonColors(containerColor = Color.Red),   // 按钮颜色
            onClick = { /*TODO*/ }) {
            Text(text = "颜色", fontSize = 30.sp)
        }
    }

}

@Preview(showSystemUi = true)
@Composable
fun Page3Preview() {
    Page3()
}

